<?php if($search):?>
<h2>查询月固定费用信息</h2>
<?php else:?>
<h2>修改月固定费用信息</h2>
<?php endif?>
<?php echo CHtml::beginForm(array($search?'search':'admin'),'post');?>
<table  style="margin: 0 auto;"  width="960">
<tr><td>
	车牌号：<input type="text" name="keys[trucks.plate_no]" size="5" value="<?php echo isset($_GET['keys']['trucks.plate_no'])?$_GET['keys']['trucks.plate_no']:'';?>"/>
	有效时间：<input type="text" id="keys[s_date]" name="keys[s_date]" size="7" value="<?php echo isset($_GET['keys']['s_date'])?$_GET['keys']['s_date']:'';?>"/>
	<?php $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>'keys[s_date]','ifFormat'=>'%Y-%m'));?> 
	模糊查询：<input type="radio" name="keys[blur]" value="1" checked/>是  
	<input type="radio" name="keys[blur]" value="0" <?php echo isset($_GET['keys']['blur'])&&$_GET['keys']['blur']==0?'checked':'';?>/>否 
	<input type="submit" value="搜索"/>
</td></tr></table>
<?php echo CHtml::endForm();?>
<table class="dataGrid"  width="960">
  <thead>
  <tr>
    <th width="40"><?php echo CHtml::encode('序号'); ?></th>
    <th width="100"><?php echo $sort->link('plate_no'); ?></th>
    <th width="80"><?php echo $sort->link('depreciation'); ?></th>
    <th width="100"><?php echo $sort->link('handling_cost'); ?></th>
    <th width="100"><?php echo $sort->link('wage_expenditure'); ?></th>
    <th width="100"><?php echo $sort->link('gps_cost'); ?></th>
    <th width="100"><?php echo $sort->link('another_cost'); ?></th>
    <th width="100"><?php echo $sort->link('the_other_cost'); ?></th>
    <th width="80"><?php echo $sort->link('effect_date'); ?></th>
    <th width="80"><?php echo $sort->link('lapse_date'); ?></th>
	<?php if(!$search):?><th  width="80">操作</th><?php endif ?>
  </tr>
  </thead>
  <tbody>
<?php //序号生成 
$page_now=isset($_GET['page'])?$_GET['page']:1;
$page_size=Yii::app()->params['page_size']['constant_expense'];
?> 
<?php foreach($models as $n=>$model): ?>
  <tr class="<?php echo $n%2?'even':'odd';?>">
    <?php 
    	$url=array('show','id'=>$model->id)+$_GET;//把所有参数包括页码、查询参数传入显示信息页面
    	$url['ret']=$search?'search':'admin';
    ?>
    <td><?php echo $page_size*($page_now-1)+$n+1; ?></td>
    <td><?php echo CHtml::link($model->plate_no,$url); ?></td>
    <td><?php echo CHtml::encode($model->depreciation); ?></td>
    <td><?php echo CHtml::encode($model->handling_cost); ?></td>
    <td><?php echo CHtml::encode($model->wage_expenditure); ?></td>
    <td><?php echo CHtml::encode($model->gps_cost); ?></td>
    <td><?php echo CHtml::encode($model->another_cost); ?></td>
    <td><?php echo CHtml::encode($model->the_other_cost); ?></td>
    <td><?php echo CHtml::encode(substr($model->effect_date,0,7)); ?></td>
    <td><?php echo CHtml::encode(substr($model->lapse_date,0,7)); ?></td>
    <?php if(!$search):?>
    <td>
      <?php echo CHtml::link('修改',array('update','id'=>$model->id)+$_GET); ?>
     <?php echo CHtml::link('删除',array('delete','id'=>$model->id)+$_GET,array('confirm'=>"确定要删除车牌号 {$model->plate_no} 的月固定费用吗？")); ?>
	</td>
	<?php endif ?>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>
<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages,'htmlOptions'=>array('style'=>'width:960px;'))); ?>
